package lumis.portal.presentation.core;

import java.util.Map;

import lumis.portal.PortalRequestParameters;
import lumis.portal.page.PageWebResource;
import lumis.portal.presentation.PresentationControllerHtml.DataPreviewMode;

import org.apache.wicket.markup.IMarkupCacheKeyProvider;
import org.apache.wicket.markup.IMarkupResourceStreamProvider;

/**
 * Provides methods for rendering page HTML fragments and obtaining information
 * necessary for processing the layout.
 *
 * @version $Revision: 13093 $ $Date: 2011-05-28 18:40:18 -0300 (Sat, 28 May 2011) $
 * @since 6.0.0
 */
public interface IPageRenderer
{	
	/**
	 * Evaluates an EL expression.
	 * @param expression the expression.
	 * @return the evaluated value.
	 * @since 6.0.0
	 */
	public CharSequence evaluateEL(String expression);
	
	/**
	 * Returns the root channel Id of the page to render.
	 * @return the root channel Id of the page to render.
	 * @since 6.0.0
	 */
	public String getRootChannelId();
	
	/**
	 * Returns the mode of the portal when the page is required.
	 * @return the mode of the portal when the page is required.
	 * @since 6.0.0
	 */
	public DataPreviewMode getDataPreviewMode();
	
	/**
	 * Returns the existing previous parameters as XML string when a page is requested. 
	 * @return the existing previous parameters as XML string when a page is requested.
	 * @since 6.0.0
	 */
	public String getPreviousParametersXmlString();
	
	/**
	 * Returns the {@link PortalRequestParameters parameters}.
	 * @return the parameters.
	 * @since 6.0.0
	 */
	public PortalRequestParameters getParameters();
	
	/**
	 * Returns the multi part form parameters, usually present in file uploads requests.
	 * @return multi part form parameters.
	 * @since 6.0.0
	 */
	public Map<String, String[]> getMultiPartFormParameters();
	
	/**
	 * Returns the service interface instance identifier of the service interface instance source of   
	 * {@link #getMultiPartFormParameters() multi part form parameters}.
	 * @return the service interface instance identifier of the service interface instance source of   
	 * {@link #getMultiPartFormParameters() multi part form parameters}.
	 * @since 6.0.0
	 */
	public String getMultiPartFormServiceInterfaceInstance();
	
	/**
	 * Returns the service interface instance identifier of the service interface instance target of
	 * the process action.
	 * @return the service interface instance identifier of the service interface instance target of
	 * the process action.
	 * @since 6.0.0
	 */
	public String getExecutedProcessActionServiceInterfaceInstanceId();	
	
	public PageWebResource getWebResource();

	/**
	 * Returns the provider for the markup resource stream to be used to render
	 * the page.
	 * @return the markup resource stream provider.
	 * @since 5.6.0
	 */
	public IMarkupResourceStreamProvider getMarkupResourceStreamProvider(LayoutFilePage layoutFilePage);
	/**
	 * Returns the key used for caching the markup used to render
	 * the page.
	 * @return the markup cache key.
	 * @see IMarkupCacheKeyProvider
	 * @since 6.0.0
	 */
	public String getMarkupCacheKey(LayoutFilePage layoutFilePage);
}